/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vm.help;

import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;

/**
 *
 * @author Peer
 */
public class HelpTableCellRenderer extends DefaultTableCellRenderer {
    
    int columnToCenter = 0;
    JLabel renderer;

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {

        renderer = (JLabel)super.getTableCellRendererComponent(table, value, false, false, row, column);

        if(table.convertColumnIndexToModel(column)==columnToCenter)
            renderer.setHorizontalAlignment(JLabel.CENTER);
        else
            renderer.setHorizontalAlignment(JLabel.LEFT);
        return renderer;
    }
}
